
/*
 * GUI which can display table for database with a Update, Edit or Delete button
 * @ Kenneth.
 */


import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;

import java.awt.*;


public class GUI_Database extends JFrame {
	
	static JTextArea textArea = new JTextArea("text");
	
	public GUI_Database() {
		
		JPanel p1= new JPanel ();
		//p1.setLayout(new GridLayout (1, 1));
		 for (int i =1; i <= 1; i++){
			 
			// p1.add(new JButton ("" +1));
		 }
		 //p1.add(new JButton ("" + 1));
		
		 p1.add(new JButton ("Add"));
		 p1.add(new JButton ("Edit"));
		 p1.add(new JButton ("Delete"));
		 
		 JButton pUpdate = new JButton("Update");
		 pUpdate.setForeground(Color.WHITE);
		 
		 JPanel p2 = new JPanel (new BorderLayout());
		 p2.add(new JTextField("Welcome to Database table"), BorderLayout.NORTH);
		 p2.add(p1, BorderLayout.CENTER);
		
		 
		 add(p2, BorderLayout.EAST);
		 add(textArea, BorderLayout.CENTER);
		
		
		 
		 
		 // add(new JTextFied("Food Prices to be displayed here "), BorderLayout.CENTER);
		
		// JButton jbtCentre = new JButton ("Centre");
		 //jbtCentre.setForeground(Color.red);
		 
		 
	}
	
	public static void menu(String abba){
    	
    textArea.setText(abba);
   
    }
	
	public static void edit(){
		GUI_Database frame =new GUI_Database();
		frame.setTitle(" JDecider - Edit your database");
		frame.setSize(800, 600);
		frame.setLocationRelativeTo(null);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setVisible(true);
		ConnectDB.menu();
		
	}

}
